home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CONTRSRC.ZIP / SRC / WAVES / 3DICE.ASM next >
Encoding:
Assembly Source File  |  1994-11-12  |  49.3 KB  |  2,034 lines

  1. ;**********************************************************
  2. ;* ICEBERG effect !!!!! (C) Type One 1994 / TFL-TDV Prod. *
  3. ;**********************************************************
  4.  
  5. INCLUDE PDFIK.INC ; DataFile Manager
  6. INCLUDE VIDEO.INC ; Flamoot VGA SetUp
  7. INCLUDE PLAYINFO.INC ; Player structures
  8. INCLUDE KEYBOARD.INC ; keyboard macros
  9.  
  10. ; declaration modèle mémoire
  11. ;----------------------------
  12. .386
  13. DGROUP GROUP _DATA,_BSS
  14. ICE_TEXT  SEGMENT DWORD PUBLIC USE16 'CODE'
  15.           ASSUME CS:ICE_TEXT,DS:DGROUP
  16. ICE_TEXT  ENDS
  17. _DATA  SEGMENT DWORD PUBLIC USE16 'DATA'
  18. _DATA  ENDS
  19. _BSS   SEGMENT DWORD PUBLIC USE16 'BSS'
  20. _BSS   ENDS
  21. ;-----------------------------
  22.  
  23. _DATA SEGMENT
  24.  
  25. ; Quelques constantes bien utiles ......
  26.  
  27. Larg = 160       ; hauteur de l'écran en pixels
  28. Haut = 30        ; largeur de l'écran en pixels
  29. Windowx = 160    ; largeur fenetre
  30. Windowy = 30     ; hauteur fenetre
  31.  
  32. Screen1 = 0
  33. Screen2 = ((160*2)*200/4)
  34. Screen3 = ((160*2)*200/4*2)
  35. Screen4 = ((160*2)*200/4*3)
  36.  
  37. ;-- donnees pattern --
  38. EXTRN _Datafile  : BYTE 
  39. EXTRN _OfsinDta  : DWORD
  40. Picname   BYTE 'mandel.bin',0
  41. Backname  BYTE 'backgrnd.raw',0
  42. Curvname  BYTE 'curve.bin',0
  43. Picparam  PARAM_STRUC<2,DGROUP,OFFSET _Datafile,OFFSET Backname,0,0,0,,,0>
  44.  
  45. LenOFVline EQU (OFFSET laby48 - OFFSET laby49)
  46. OpcodeSize EQU 5 ; SizeOf(mov WORD PTR[di+1234h],12h)
  47. EVEN
  48. HautTab LABEL WORD ; convertit hauteur en offset a jumper/patcher dans rout
  49.  i=0
  50.  REPT 64
  51.  DW i
  52.  i=(i+OpcodeSize)
  53.  ENDM 
  54.  
  55. Xsize = 160   ; some constants
  56. Ysize = 30
  57. Meche = 10
  58. Debut = 80 
  59.  
  60. Ytable LABEL WORD
  61.        i = (2 + Meche) * Xsize
  62.        REPT Ysize
  63.        DW i
  64.        i = i + Xsize
  65.        ENDM
  66.  
  67. cumul_step_lo DD 0
  68. cumul_step_hi DD 0
  69. cumul_old_lo  DD 0
  70. cumul_old_hi  DD 0
  71.  
  72.  
  73. EXTRN _BlackPal: BYTE
  74. EXTRN _WhitePal: BYTE
  75.  
  76. _DATA ENDS
  77.  
  78. ; -- données non initialisées --
  79. _BSS SEGMENT
  80.  
  81. EXTRN _FrameCounter     : WORD
  82. EXTRN _SinusTbl         : WORD  ; table sinus*256
  83. EXTRN _StartAdr         : WORD
  84. EXTRN _WorkAdr          : WORD
  85. EXTRN _NextAdr          : WORD
  86. EXTRN _Triple           : WORD
  87. EXTRN _SyncFlag         : WORD
  88. EXTRN _TmpPal           : BYTE
  89. EXTRN _FadeON           : WORD
  90.  
  91. ;!!!!!!!!!! synchro avec music !!!!!!!!!!!!
  92. EXTRN _MP               : DWORD ; extern ModulePlayer * MB
  93. EXTRN _ReplayInfo       : mpInformation
  94.  
  95. ;---- param pour synchro avec zizik ----
  96. EVEN
  97. DebSong  WORD ?
  98. FinSong  WORD ?
  99.  
  100. Termine  WORD ?        ; flag pour terminer !!!
  101.  
  102. EVEN
  103. CurvSeg  WORD ?        ; segment of wave curve...
  104.  
  105. ALIGN 4
  106. EVEN
  107. Begin   = (Xsize*(2+Meche))
  108. Overflow = Xsize
  109. SizeBuf = (Xsize*(Ysize+2+Meche)+Overflow)
  110. BufSeg  WORD ?         ; seg of buffer for flames
  111. BufSeg2 WORD ?
  112. BufPtr  WORD ?
  113. BufPtr2 WORD ?
  114. ALIGN 4
  115. EVEN
  116. Maxima DB Xsize DUP(?)
  117.  
  118. EVEN
  119. WaveFlag WORD ?
  120.  
  121. EVEN                
  122. CurvePtr   WORD ?       ; wave curve parameters 
  123. CurveStep  WORD ?
  124. SpirAngle  WORD ?       ; spiral angle
  125. SpirRadius WORD ?       ;   "    radius
  126. CircRadius WORD ?       ; circle radius
  127.  
  128. EVEN
  129. Dest DW ?
  130.  
  131. EVEN
  132. Backseg  WORD ?        ; seg for background
  133. PicSeg   WORD ?        ; ptr vers segment pattern
  134. TmpSeg   WORD ?        ; ptr Tmp ...
  135. TmpOfs   WORD ?        ; OFFSET second map in Tmp
  136. Temps    WORD ?
  137.  
  138. ;-------- Flag d'autorisation ---------
  139. Wave1  WORD ?
  140. Wave2  WORD ?
  141. Goutte WORD ?
  142. Oxygen WORD ?
  143. Spir   WORD ?
  144. Circ   WORD ?
  145. Plouf  WORD ?
  146. WavTxt WORD ?
  147. Mandel WORD ?
  148.  
  149. FadeFlag WORD ?        ; flag pour fading
  150. FadePtr1 WORD 2 DUP(?) ; ptr sur palette a fader
  151. FadePtr2 WORD 2 DUP(?)
  152. Delai    WORD ?
  153.  
  154. _BSS ENDS
  155.  
  156. ICE_TEXT SEGMENT
  157.       EXTRN _GetRandom  : FAR
  158.       EXTRN _Amorce     : FAR
  159.       EXTRN _AveragePAL : FAR
  160.       PUBLIC _StartIce
  161.  
  162. ALIGN
  163. EVEN
  164. _StartIce PROC FAR
  165.  
  166.          push    bp                  ; bâtit le cadre de pile
  167.          mov     bp,sp
  168.          
  169.          pushad
  170.          MPUSH ds,es,fs,gs
  171.  
  172.          STARTUP         
  173. ;------- recuperer parametres sur le stack !!!! --------
  174.  
  175.          mov     ax,WORD PTR ss:[bp+6]  ; debut pos
  176.          shl     eax,14        
  177.          or      ax,WORD PTR ss:[bp+8]  ; debut row
  178.          or      ah,al
  179.          shr     eax,8
  180.          mov     DebSong,ax
  181.          mov     ax,WORD PTR ss:[bp+10] ; fin pos
  182.          shl     eax,14 
  183.          or      ax,WORD PTR ss:[bp+12] ; fin row
  184.          or      ah,al
  185.          shr     eax,8
  186.          mov     FinSong,ax
  187.          xor     eax,eax
  188. ;-------------------------------------------------------
  189.  
  190.  
  191.          push    m320x200x256p
  192.          call    _SetVGA
  193.          add     sp,2  
  194.  
  195.          STARTUP
  196. ;--------------------------------------
  197.          call    IceBerg             ; !!!!! iceberg part !!!!!
  198. ;--------------------------------------
  199.  
  200.          mov  dx,3c4h
  201.          mov  ax,0f02h
  202.          out  dx,ax
  203.          mov  ax,0a000h              ; clear screen
  204.          mov  es,ax
  205.          xor  eax,eax
  206.          xor  di,di
  207.          mov  cx,65536/4
  208.          rep  stosd
  209.  
  210.          MPOP ds,es,fs,gs
  211.          popad
  212.          nop
  213.  
  214.          leave                             ; restore stack
  215.                                            ; mov sp,bp + pop bp
  216.          retf                              ; C/C++ retirera le param 
  217.  
  218. _StartIce ENDP
  219.  
  220. ;==============================================================================
  221. ;=============================== IceBerg part =================================
  222. ;==============================================================================
  223.  
  224. IceBerg PROC NEAR
  225.  
  226. ;************ some macros ************
  227.  
  228. NEXTSTEP MACRO
  229.         LOCAL lbl1
  230.  
  231. ;------------ FrameCounter manip ------------
  232.         MPUSH  eax,ebx,ecx,edx
  233.  
  234.         mov    cx,_FrameCounter
  235.         test   cx,cx
  236.         jnz    lbl1
  237.         mov    cx,1
  238.  
  239. lbl1:   xor    eax,eax
  240.         mov    ah,cl ; frame*256
  241.        ; mov    ax,256 ;307              ; 1.2*256 = factor
  242.        ; mul    cx
  243.  
  244.         mov    ecx,cumul_step_lo   ; save old cumulated step (64 bits)
  245.         mov    cumul_old_lo,ecx
  246.         mov    ecx,cumul_step_hi
  247.         mov    cumul_old_hi,ecx   
  248.      
  249.         add    cumul_step_lo,eax   ; multiprecision
  250.         adc    cumul_step_hi,0
  251.  
  252.         mov    ecx,cumul_step_hi
  253.         mov    eax,cumul_step_lo
  254.         shrd   eax,ecx,8           ; / 256
  255.         mov    edx,cumul_old_hi
  256.         mov    ebx,cumul_old_lo
  257.         shrd   ebx,edx,8
  258.  
  259.         sub    eax,ebx
  260. ;        sbb    ecx,edx
  261.  
  262.         mov    CurveStep,ax  ; CurveStep = factor * FrameCounter
  263.  
  264.         mov    _FrameCounter,0
  265.  
  266.         MPOP   eax,ebx,ecx,edx
  267. ;--------------------------------------------
  268.  
  269. ENDM
  270.  
  271.  
  272.  
  273. ;====================================================
  274.  
  275. FADING   MACRO
  276.          LOCAL NewFade,Faddi,Passer
  277. ; ---------- Fading -----------
  278.  
  279.          cmp     FadeFlag,255
  280.          jb      NewFade
  281.  
  282.          cmp     Termine,1    ; Terminer si dernier fade fini
  283.          je      GoOut
  284.  
  285.          mov     _FadeON,0    ; don't set _TmpPal anymore ...
  286.          jmp     Passer
  287.  
  288. NewFade: MPUSH   ax,cx
  289.  
  290.          mov     ax,FadeFlag  ; average Black-MyPal
  291.  
  292.          push    ax
  293.          push    ds
  294.          push    OFFSET _TmpPal
  295.          mov     ax,FadePtr1+2
  296.          push    ax         
  297.          mov     ax,FadePtr1
  298.          push    ax
  299.          mov     ax,FadePtr2+2 
  300.          push    ax
  301.          mov     ax,FadePtr2
  302.          push    ax
  303.  
  304.          call    _AveragePAL
  305.          add     sp,7*2
  306.  
  307.          mov     _FadeON,1            ; set new PAL during next VR !!!
  308.          mov     cx,CurveStep
  309.          sub     cx,Delai             ; temps chargement
  310.  
  311.          test    cx,cx
  312.          jnz     Faddi
  313.          inc     cx
  314. Faddi:   add     FadeFlag,4           ; inc fade ..
  315.          dec     cx
  316.          jnz     Faddi
  317.   
  318.          MPOP    ax,cx
  319. Passer:
  320.          ENDM
  321.  
  322. ;==============================================
  323.  
  324. UPDATE MACRO                 ; update variables & flags
  325.        LOCAL   lbl1,lbl2
  326.  
  327.        MPUSH   ax,cx
  328.  
  329. ; ------- maj clock -------
  330.        mov     cx,CurveStep
  331. lbl1:  inc     Temps        ; + 1/70 sec.
  332.        dec     cx           ; "clock"
  333.        jnz     lbl1
  334.  
  335.  
  336. ; ------- set effects -------
  337.        mov     ax,Temps
  338.        cmp     ax,5*70      ; 5 sec
  339.        jl      lbl2
  340.        mov     BYTE PTR cs:[Viscoz+1],3
  341.  
  342.        cmp     ax,10*70     ; 10 sec.
  343.        jl      lbl2
  344.        mov     Wave1,1      ; active 1st wave
  345.        mov     BYTE PTR cs:[Viscoz+1],4
  346.  
  347.        cmp     ax,20*70     
  348.        jl      lbl2
  349.        mov     Plouf,1      ; active ploufs
  350.  
  351.        cmp     ax,24*70 ;30*70
  352.        jl      lbl2
  353.        mov     BYTE PTR cs:[Viscoz+1],6 
  354.        mov     Circ,1       ; active big blub
  355.        mov     Wave2,1      ; active 2nd wave
  356.  
  357.        cmp     ax,40*70
  358.        jl      lbl2
  359.        mov     BYTE PTR cs:[Viscoz+1],4
  360.        mov     Goutte,0     ; no more gouttes
  361.        mov     Spir,1       ; active Spir ...
  362.        mov     Plouf,0      ; no more ploufs
  363.  
  364.        cmp     ax,50*70
  365.        jl      lbl2
  366.        mov     Spir,0
  367.        mov     BYTE PTR cs:[Viscoz+1],3 ; - visqueux
  368.        mov     WavTxt,1
  369.  
  370.        cmp     ax,50*70
  371.        jl      lbl2
  372.        mov     Spir,1
  373.  
  374.        cmp     ax,60*70
  375.        jl      lbl2
  376.        mov     BYTE PTR cs:[Viscoz+1],4
  377.        mov     Goutte,1
  378.        mov     Plouf,1
  379.  
  380.        cmp     ax,90*70
  381.        jl      lbl2
  382.        mov     Plouf,0
  383.        mov     Spir,0
  384.  
  385.        cmp     ax,94*70
  386.        jl      lbl2
  387.        mov     Wave1,0
  388.        mov     Wave2,0
  389.  
  390.        cmp     ax,95*70
  391.        jl      lbl2
  392.        mov     Mandel,1
  393.        mov     Spir,1
  394.        mov     Wave1,1
  395.        mov     Wave2,1
  396.  
  397.        cmp     ax,100*70
  398.        jl      lbl2
  399.        mov     Plouf,1
  400.  
  401. lbl2:
  402.  
  403.        mov     Delai,0
  404.  
  405.        MPOP    ax,cx
  406.  
  407.        ENDM
  408.  
  409. ;======================================================
  410.  
  411. DOEFFECT MACRO
  412.        LOCAL   Nof,lbl1,lbl2,lbl3,lbl4,lbl5,lbl6,lbl7,lbl8,lbl9
  413.  
  414.        cmp     CurveStep,2
  415.        jge     lbl1
  416.        test    WaveFlag,1
  417.        jz      Nof
  418. lbl1:  call    Fluid               ; do fluid consistence
  419.  
  420.        cmp     CurveStep,2
  421.        jl      lbl2
  422.     
  423. Nof:
  424.        test    Goutte,1            ; can we do some "goutelettes" ?
  425.        jz      lbl2
  426.        call    Gouttes
  427.   
  428. lbl2:  xor     WaveFlag,1
  429.  
  430.        test    Wave1,1             ; 1st wave ?????
  431.        jz      lbl3
  432.        call    DoWave              ; do some perturbations (if we can)  
  433. lbl3:
  434.        test    Oxygen,1
  435.        jz      lbl4
  436.        call    Oxygene             ; some oxygenation ?????
  437. lbl4:
  438.        test    Circ,1              ; some circles ???
  439.        jz      lbl5
  440.        call    Circles 
  441. lbl5:
  442.        test    Spir,1              ; some spiral ?
  443.        jz      lbl6
  444.        call    Spiral
  445. lbl6:
  446.        test    Plouf,1             ; some ploufs ???
  447.        jz      lbl7
  448.        call    Ploufs
  449. lbl7:
  450.        test    WavTxt,1           
  451.        jz      lbl8
  452.        call    PutTxt              ; Put text !!!!!
  453. lbl8:
  454.        test    Mandel,1
  455.        jz      lbl9
  456.        call    PutMandel           ; Put MandelBrot !!!!!
  457. lbl9:
  458.  
  459.        ENDM
  460.  
  461. ;=======================================================
  462.  
  463. TESTEND  MACRO
  464.          LOCAL NoFade
  465.  
  466.          MPUSH  eax,bx,es
  467.  
  468. ;----------- test if we must finish ... ----------
  469.  
  470.          mov     _ReplayInfo.numChannels,4 ; 4 voices
  471.          
  472.          les     bx,DWORD PTR[_MP]
  473.          push    ds
  474.          push    OFFSET _ReplayInfo
  475.  
  476.          ; _MP->GetInformation(&ReplayInfo)
  477.  
  478.          call    (ModulePlayer PTR es:[bx]).GetInformation
  479.          add     sp,4
  480.  
  481.          mov     ax,_ReplayInfo.pos
  482.          shl     eax,14
  483.          or      ax,_ReplayInfo.row
  484.          or      ah,al
  485.          shr     eax,8
  486.  
  487.          cmp     ax,WORD PTR[FinSong]    ; is it time ????
  488.          jb      NoFade                  ; to fade off ???
  489.  
  490.          mov     Termine,1
  491.  
  492.          cmp     FadePtr2,OFFSET _BlackPal
  493.          je      NoFade
  494.  
  495.          mov     FadeFlag,0
  496.          mov     eax,DWORD PTR[FadePtr2]
  497.          mov     DWORD PTR[FadePtr1],eax   ; fade to black !!!!
  498.          mov     ax,ds
  499.          mov     FadePtr2+2,ax
  500.          mov     FadePtr2,OFFSET _BlackPal
  501.  
  502. NoFade:
  503.  
  504.          MPOP    eax,bx,es
  505.  
  506.        ENDM
  507.  
  508. ;=========================================================
  509.  
  510. ;************************************
  511.  
  512.  
  513.        pushad  
  514.        MPUSH  ds,es,fs,gs
  515.  
  516.  
  517.          mov     eax,_OfsinDta         ; OFFSET in Datafile
  518.          mov     Picparam.OfsInPdf,eax
  519.          mov     ax,_DATA              ; prepare for PDFIK call 
  520.          mov     es,ax 
  521.          mov     bx,OFFSET Picparam  
  522.          pusha 
  523.          call    PDFIK_ASM             ; call function 2 (extract+alloc)
  524.          popa
  525.          mov     ax,Picparam.BufSeg ; where is the file in mem ?  
  526.          mov     Backseg,ax
  527.  
  528.          push    ds
  529.          push    es
  530.          mov     ax,Backseg
  531.          mov     ds,ax                 ; 32 bytes for Alchemy Header
  532.          mov     si,32                 ; palette offset 
  533.          mov     es,ax
  534.          mov     di,32
  535.  
  536.          mov     cx,768                ; 256*3 components
  537. @@:      lodsb
  538.          shr     al,2                  ; 8 to 6 bits conversion
  539.          stosb
  540.          dec     cx
  541.          jnz     @B
  542.  
  543.          pop     es
  544.          pop     ds
  545.  
  546.  
  547. ; * charger MandelBrot pic *
  548.        mov     Picparam.DtaOfsFil,OFFSET Picname ; name of pic 2
  549.        mov     eax,_OfsinDta         ; OFFSET in Datafile
  550.        mov     Picparam.OfsInPdf,eax 
  551.        mov     ax,DGROUP             ; prepare for PDFIK call
  552.        mov     es,ax
  553.        mov     bx,OFFSET Picparam
  554.        pusha
  555.        call    PDFIK_ASM             ; call function 2 (extract+alloc)
  556.        popa
  557.        mov     ax,Picparam.BufSeg    ; where is the file in mem ?
  558.        mov     Picseg,ax             
  559.  
  560.        mov     eax,Picparam.NormSize ; taille file
  561.        mov     TmpOfs,ax             ; stocker offset
  562.        add     ax,ax
  563.        shr     ax,4
  564.        inc     ax
  565.        mov     bx,ax                 ; memory requested
  566.  
  567.        mov     ah,48h                ; MALLOC
  568.        xor     al,al
  569.        int     21h
  570.        mov     TmpSeg,ax             ; Segment address returned
  571.  
  572.  
  573.        mov     Picparam.DtaOfsFil,OFFSET Curvname ; name of curve table
  574.        mov     eax,_OfsinDta         ; OFFSET in Datafile
  575.        mov     Picparam.OfsInPdf,eax 
  576.        mov     ax,DGROUP             ; prepare for PDFIK call
  577.        mov     es,ax
  578.        mov     bx,OFFSET Picparam
  579.        pusha
  580.        call    PDFIK_ASM             ; call function 2 (extract+alloc)
  581.        popa
  582.        mov     ax,Picparam.BufSeg    ; where is the file in mem ?
  583.        mov     CurvSeg,ax             
  584.  
  585.  
  586.        mov     ah,48h                ; MALLOC
  587.        mov     bx,(SizeBuf SHR 4)+1  ; memory requested
  588.        int     21h
  589.        mov     BufSeg,ax             ; Segment address returned
  590.        mov     BufPtr,ax
  591.        mov     ah,48h
  592.        mov     bx,(SizeBuf SHR 4)+1
  593.        int     21h
  594.        mov     BufSeg2,ax
  595.        mov     BufPtr2,ax 
  596.         
  597.        call   PutBack
  598.        call   InitMap
  599. ;       call   _Amorce 
  600.  
  601. ;*********************************************************
  602. ;---- wait right position/row in tune ----
  603.  
  604. WaitPos: 
  605.          mov     _ReplayInfo.numChannels,4 ; 4 voices
  606.          
  607.          les     bx,DWORD PTR[_MP]
  608.          push    ds
  609.          push    OFFSET _ReplayInfo
  610.  
  611.          ; _MP->GetInformation(&ReplayInfo)
  612.  
  613.          call    (ModulePlayer PTR es:[bx]).GetInformation
  614.          add     sp,4
  615.  
  616.          mov     ax,_ReplayInfo.pos
  617.          shl     eax,14
  618.          or      ax,_ReplayInfo.row
  619.          or      ah,al
  620.          shr     eax,8 
  621.          cmp     ax,WORD PTR[DebSong]  ; is it time ????
  622.          jb      WaitPos
  623.  
  624.          mov     _FrameCounter,0
  625.          mov     Delai,0
  626.          xor     eax,eax   
  627. ;------------------------------------------
  628. ;*********************************************************
  629.  
  630.        mov     Termine,0 ; pas encore terminer !!!
  631.  
  632.        mov     bx,_StartAdr
  633.        mov     WORD PTR[bx],Screen1   ; _StartAdr->base = 0
  634.        mov     WORD PTR[bx+2],0       ; _StartAdr->flag = false
  635.        mov     bx,_WorkAdr
  636.        mov     WORD PTR[bx],Screen2   ; _WorkAdr->base
  637.        mov     WORD PTR[bx+2],0       ; _WorkAdr->flag = false
  638.        mov     bx,_NextAdr
  639.        mov     WORD PTR[bx],Screen3   ; _NextAdr->base
  640.        mov     WORD PTR[bx+2],0       ; _NextAdr->flag = false
  641.        mov     _Triple,1              ; triple buffering
  642. ;       mov     ax,_FrameCounter
  643. ;       mov     Delai,ax               ; Delai chargement
  644.  
  645.        VSYNC
  646.  
  647.  
  648.  
  649. ;--------- init fading ----------
  650.        mov     Temps,0
  651.        mov     _FadeON,0
  652.        mov     FadeFlag,0
  653.        mov     FadePtr1,OFFSET _BlackPal  ; Black to pic for the beginning !!!
  654.        mov     ax,ds
  655.        mov     FadePtr1+2,ax
  656.        mov     FadePtr2,32
  657.        mov     ax,Backseg
  658.        mov     FadePtr2+2,ax
  659. ;--------------------------------
  660.  
  661. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  662. ;*************** MAIN loop *****************
  663. ;--------------
  664. EVEN
  665. Main:
  666.  
  667.  
  668. ;***** 2nd page *****
  669. Do_a_frame:
  670.        mov  di,_WorkAdr
  671.        cmp  WORD PTR[di+2],1 ; _WorkAdr->flag true (previous _NextAdr) ?
  672.        je   NextFrame        ; then construct next frame
  673.  
  674.        NEXTSTEP              ; new step !!!
  675.  
  676.        FADING                ; macro for fading
  677.  
  678.        UPDATE                ; update flags,vars,counters
  679.                              ; and set FrameCounter to 0
  680.  
  681.        TESTEND               ; test if end-pos ??? --> if yes fade off
  682.  
  683.        SHOWTIME 48
  684.  
  685.        call    ClearMap     ; clear Work-buffer (warning modify reg !!!)
  686.  
  687.        SHOWTIME 32
  688.  
  689.        DOEFFECT             ; do the <> effects and set some flags
  690.  
  691.        SHOWTIME 24
  692.  
  693.        call    PrintMap     ; project the map onto Work-buffer
  694.        mov    di,_NextAdr   ; save adr of next buffer
  695.  
  696.        mov    bx,Dest
  697.        mov    WORD PTR[bx+2],1     ; _WorkAdr->flag = true
  698.  
  699.        SHOWTIME 0
  700.  
  701.        jmp  Nexxxt
  702.  
  703. ;******** 3rd page *********
  704. NextFrame:
  705.        mov  di,_NextAdr
  706.        cmp  WORD PTR[di+2],1 ; _NextAdr true ?
  707.        je   NextFrame 
  708.     
  709. Nexxxt:
  710.  
  711.        NEXTSTEP              ; new step !!!
  712.  
  713.        FADING                ; macro for fading !!!!
  714.  
  715.        UPDATE                ; set vars,counters,flags and
  716.                              ; set FrameCounter to 0
  717.  
  718.        TESTEND               ; test if end-pos ???? --> if yes fade off
  719.  
  720.        SHOWTIME 48
  721.  
  722.        call    ClearMap            ; clear screen (warning modify reg. !!)
  723.  
  724.        SHOWTIME 32
  725.  
  726.        DOEFFECT                    ; call the <> effects and set some flags
  727.  
  728.        SHOWTIME 24
  729.  
  730.        call   PrintMap
  731.  
  732.        mov    bx,Dest
  733.        mov    WORD PTR[bx+2],1     ; _NextAdr->flag = true
  734.  
  735.        SHOWTIME 0
  736.  
  737.        LOOP_UNTIL_KEY Main         ; wait a key else loop
  738.  
  739. GoOut:
  740.  
  741. ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  742.  
  743.        FLUSH_KEYBUF                ; flush keyboard buffer !!!
  744.  
  745.         mov     _FadeON,0             ; to be sure ....
  746.  
  747. ;----- EXIT -----
  748.  
  749.         STARTUP
  750.         mov     ax,BufSeg2
  751.         mov     es,ax
  752.         mov     ah,49h
  753.         int     21h
  754.         mov     ax,BufSeg             ; segment to free
  755.         mov     es,ax
  756.         mov     ah,49h                ; MFREE
  757.         int     21h
  758.  
  759.         mov     ax,CurvSeg
  760.         mov     es,ax
  761.         mov     ah,49h
  762.         int     21h 
  763.         mov     ax,TmpSeg
  764.         mov     es,ax
  765.         mov     ah,49h
  766.         int     21h
  767.         mov     ax,Picseg             ; segment to free
  768.         mov     es,ax
  769.         mov     ah,49h                ; MFREE
  770.         int     21h
  771.         mov     ax,Backseg
  772.         mov     es,ax
  773.         mov     ah,49h
  774.         int     21h
  775.  
  776.         MPOP    ds,es,fs,gs
  777.         popad
  778.         nop 
  779.         ret
  780.  
  781. IceBerg ENDP
  782.  
  783. ;***************************
  784. ;* Clear the Map on screen *
  785. ;***************************
  786.  
  787. ClearMap PROC NEAR
  788.  
  789.          mov  Dest,di          ; save pointer
  790.          mov  di,WORD PTR[di]  ; _NextAdr->base
  791.          add  di,(Debut+15)*(Xsize*2)/4
  792.          mov  ax,0a000h
  793.          mov  es,ax
  794.          mov  dx,3c4h
  795.          mov  ax,0f02h
  796.          out  dx,ax           
  797.  
  798.          push dx
  799.          mov  dx,3ceh
  800.          mov  ax,4105h         ; mode VGA write 1
  801.          out  dx,ax  
  802.  
  803.          push si
  804.          push ds
  805.          mov  ax,0a000h
  806.          mov  ds,ax
  807.          mov  si,Screen4+(Debut+15)*(Xsize*2)/4
  808.          mov  cx,(Xsize*2)*42/4          ; restore 42 pixels of the background
  809.          rep  movsb
  810.          pop  ds
  811.          pop  si
  812.  
  813.          mov  ax,4005h         ; mode VGA write 0
  814.          out  dx,ax
  815.          pop  dx
  816.           
  817.          xor  eax,eax
  818.          mov  cx,(Xsize*2)*(64-42)/(4*4) ; clear screen
  819.          rep  stosd
  820.  
  821.          ret
  822.  
  823. ClearMap ENDP
  824.  
  825. ;*****************************************
  826. ;* Print the Map in False Goraud Shading *
  827. ;*****************************************
  828. ALIGN
  829. EVEN
  830. PrintMap PROC NEAR
  831.  
  832.        pushad
  833.        MPUSH ds,es,fs,gs
  834.  
  835.        mov  ax,BufPtr
  836.        mov  fs,ax
  837.  
  838.        push ds
  839.        push es
  840.        pop  ds
  841.        pop  es         ; xchg ds,es
  842.  
  843.        xor  edx,edx    ; clean edx
  844.        xor  ecx,ecx    ; clean ecx
  845.        xor  eax,eax    ; clean eax 
  846.  
  847.        mov  di,OFFSET Maxima
  848.        mov  cx,Xsize/4 ; clear Maxima 
  849.        rep  stosd
  850.  
  851.        i=0
  852.        REPT 2
  853.        LOCAL Affich,PrintMap
  854.        mov  dx,3c4h
  855.        mov  ax,02h+(3 SHL (i*2))*256       ; ie plane
  856.        out  dx,ax  
  857.        mov  bx,(Begin+i+(Xsize*(Ysize-1))) 
  858.        mov  si,OFFSET laby49               ; offset rout layer 1
  859.                                            ; Maxima = array for max. height
  860.  
  861.        xor  ax,ax   
  862.        mov  cx,Ysize-1                     ; 30 layers
  863.        EVEN                                ; align label
  864. PrintMap:
  865.  
  866.        mov  di,es:[Dest]                   ; begin by the beginning
  867.        mov  di,WORD PTR es:[di]            ; _WorkAdr->base
  868.        add  di,Debut*(Xsize*2)/4
  869.        push cx 
  870.        mov  cx,(Xsize*2)/4
  871.        EVEN                                ; align label
  872. Affich: 
  873.        mov  al,BYTE PTR fs:[bx]            ; get height
  874.        add  al,32                          ; get value between 0 - 63
  875.        mov  dl,BYTE PTR es:[Maxima+ecx*2+i-2]; get our current max height
  876.        cmp  al,dl                          ; compare with maximum height
  877.        jle  @F
  878.        mov  bp,WORD PTR es:[HautTab+eax*2] ; get coord*5
  879.        mov  BYTE PTR es:[Maxima+ecx*2+i-2],al; we have a max now !!!
  880.        xor  dh,dh                          ; clean dx ...
  881.        mov  dx,WORD PTR es:[HautTab+edx*2] ; get max*5
  882.        add  dx,si                          ; add base of rout 
  883.        mov  al,BYTE PTR cs:[si+bp]         ; save mov or ret opcode 
  884.        mov  BYTE PTR cs:[si+bp],0C3h       ; do a ret instead of mov ....
  885.        call dx                             ; call the right rout 
  886.        mov  BYTE PTR cs:[si+bp],al         ; replace the mov (0C6h)
  887. @@:    add  bx,2 
  888.        inc  di
  889.        cmp  BYTE PTR es:[Maxima+ecx*2+i-2],0
  890.        jz   @F
  891.        dec  BYTE PTR es:[Maxima+ecx*2+i-2] ; update maximum height for next
  892. @@:    dec  cx                             ; layer 
  893.        jnz  Affich                         ; better than loop on 386-486
  894.  
  895.        pop  cx
  896.  
  897.        sub  bx,Xsize*2                     ; previous line
  898.        add  si,LenOFVline                  ; ajust offset for next layer 
  899.        dec  cx
  900.        jnz  PrintMap
  901.  
  902.        i=i+1
  903.        ENDM
  904.  
  905.        MPOP ds,es,fs,gs                    ; restore DS
  906.        popad
  907.        nop
  908.        ret
  909.  
  910. PrintMap ENDP
  911.  
  912. ;*******************************
  913. ;* calculate Fluid consistence *
  914. ;*******************************
  915. ALIGN   ; effect (C) ARM/Iguana (doc taken from tin !!!)
  916. EVEN
  917. Fluid PROC NEAR
  918.  
  919.        MPUSH ax,cx,di,es,fs
  920.  
  921.        mov   ax,BufPtr2     
  922.        mov   es,ax        ; U[1]
  923.        mov   ax,BufPtr  
  924.        mov   fs,ax        ; U[0]
  925.  
  926. ; first do the fluid consistence !!!!!!!
  927.  
  928.        mov   di,Xsize*(Meche+2)
  929.  
  930.        mov   cx,Ysize
  931. EVEN
  932. @@:    push  cx
  933. Viscoz LABEL BYTE
  934.        mov   cl,2 ; 1st value     
  935.        REPT  Xsize
  936.        LOCAL Yopi,Yopi2
  937.  
  938. ; u[1,x,y] = (u[0,x-1,y] + u[0,x+1,y] + u[0,x,y-1] + u[0,x,y+1)/2 - u[1,x,y]               
  939.  
  940.        mov   al,BYTE PTR fs:[di-1]       ; u(t)
  941.        add   al,BYTE PTR fs:[di+1]
  942.        add   al,BYTE PTR fs:[di-Xsize]
  943.        add   al,BYTE PTR fs:[di+Xsize]
  944.        sar   al,1
  945.        sub   al,BYTE PTR es:[di]         ; u(t-1)
  946.  
  947. ; u[1,x,y] = 1/2^n * u[1,x,y]                  
  948.  
  949.        mov   ah,al
  950.        sar   ah,cl                       ; n = 6 !!!
  951.        sub   al,ah
  952.  
  953.        cmp   al,-32
  954.        jge   Yopi
  955.        mov   al,-32
  956. Yopi:  cmp   al,31
  957.        jle   Yopi2
  958.        mov   al,31
  959. Yopi2: stosb
  960.      
  961.        ENDM  
  962.  
  963.        pop   cx
  964.        dec   cx
  965.        jnz   @B    
  966.  
  967. finish:
  968.  
  969. ;------ swap the arrays !!! ------
  970.  
  971.        mov   ax,BufPtr     ; swap U[0] and U[1]
  972.        xchg  ax,BufPtr2
  973.        mov   BufPtr,ax
  974.  
  975.        MPOP  ax,cx,di,es,fs
  976.  
  977.        ret
  978.  
  979. Fluid ENDP
  980.  
  981.  
  982. ;*******************
  983. ;* do 1 or 2 waves *
  984. ;*******************
  985. ALIGN   
  986. EVEN
  987. DoWave PROC NEAR
  988.  
  989.        MPUSH  eax,cx,si,di,es,fs
  990.  
  991.        mov    ax,CurvSeg
  992.        mov    fs,ax                     ; segment to reference curve
  993.  
  994.        mov    ax,BufPtr
  995.        mov    es,ax 
  996.  
  997. ;  do the "perturbation" !!!!!
  998.  
  999.        xor    eax,eax   
  1000.   
  1001.        xor    si,si                     ; trajectoire wave
  1002.        add    si,CurvePtr
  1003.  
  1004.        mov    cx,CurveStep              ; what is the step ???
  1005.        test   cx,cx                     ; warning if = 0 !!!
  1006.        jnz    Yopihe
  1007.        mov    cx,1
  1008.  
  1009. Yopihe:
  1010.  
  1011. ; 1st wave !!!!!!
  1012.  
  1013.        mov    ax,WORD PTR fs:[si+2]     ; y
  1014.        mov    di,WORD PTR[Ytable+eax*2] ; y*160
  1015.        add    di,WORD PTR fs:[si]       ; + x
  1016.                                         ; DI contains position on the map !!!!!
  1017.  
  1018.        mov    al,BYTE PTR es:[di]
  1019.        sub    al,16                     ; - tranchant
  1020.        cmp    al,-32
  1021.        jge    @F
  1022.        mov    al,-32
  1023. @@:    mov    BYTE PTR es:[di],al
  1024.  
  1025. ; 2nd wave !!!!!!
  1026.  
  1027.        test   Wave2,1
  1028.        jz     no2ndWave
  1029.  
  1030.        mov    ax,WORD PTR fs:[si+512+2] ; y
  1031.        mov    di,WORD PTR[Ytable+eax*2] ; y*160
  1032.        add    di,WORD PTR fs:[si+512]   ; + x
  1033.                                         ; DI contains position on the map !!!!!
  1034.  
  1035.        mov    al,BYTE PTR es:[di]
  1036.        sub    al,16                     ; - tranchant
  1037.        cmp    al,-32
  1038.        jge    @F
  1039.        mov    al,-32
  1040. @@:    mov    BYTE PTR es:[di],al
  1041.  
  1042. no2ndWave:
  1043.  
  1044.        add    si,4
  1045.  
  1046.        add    CurvePtr,4                ; maj counter             
  1047.  
  1048.        dec    cx
  1049.        jnz    Yopihe
  1050.  
  1051.        and    CurvePtr,4095
  1052.  
  1053.        MPOP   eax,cx,si,di,es,fs
  1054.        ret
  1055.  
  1056. DoWave ENDP
  1057.  
  1058. ALIGN
  1059. EVEN
  1060. ;*******************
  1061. ; oxygene !!!! ....  
  1062. ;*******************
  1063. Oxygene PROC NEAR                     ; oxygenator
  1064.  
  1065.       MPUSH ax,bx,cx,si,es
  1066.  
  1067.       mov   ax,BufPtr
  1068.       mov   es,ax
  1069.  
  1070.       call  _GetRandom
  1071.       mov   bx,ax
  1072.       shr   bx,9
  1073.  
  1074.       mov   cx,Xsize                  ; calculate alea-lines
  1075.       mov   si,Xsize*(Meche+2)
  1076. EVEN 
  1077. oxy:  call  _GetRandom 
  1078.       cmp   ax,10000
  1079.       ja    @F
  1080.       call  _GetRandom
  1081.       mov   bx,ax
  1082.       shr   bx,9
  1083. @@:   sub   bl,32                     ; get value between -31 & 31
  1084.       sar   bl,2
  1085.       mov   BYTE PTR es:[si],bl
  1086.       mov   BYTE PTR es:[si+Xsize],bl
  1087.       inc   si
  1088.       dec   cx
  1089.       jnz   oxy                       ; loop oxy
  1090.  
  1091.       MPOP  ax,bx,cx,si,es
  1092.       ret
  1093.  
  1094. Oxygene ENDP
  1095.  
  1096.  
  1097. ALIGN
  1098. EVEN
  1099. ;************************
  1100. ; gouttes d'eau !!!! ....  
  1101. ;************************
  1102. Gouttes PROC NEAR                     ; gouttes d'eau
  1103.  
  1104.       MPUSH eax,bx,dx,si,es
  1105.  
  1106.       mov   ax,BufPtr
  1107.       mov   es,ax
  1108.  
  1109.       xor   eax,eax
  1110.  
  1111.       call  _GetRandom                ; Random(Y)
  1112.       xor   dx,dx
  1113.       mov   bx,32768/30
  1114.       div   bx
  1115.       mov   si,WORD PTR[Ytable+eax*2] 
  1116.  
  1117.       call  _GetRandom                ; Random(X)
  1118.       xor   dx,dx
  1119.       mov   bx,32768/160
  1120.       div   bx
  1121.       add   si,ax
  1122.        
  1123.       mov   bl,BYTE PTR es:[si]
  1124.       call  _GetRandom                ; "poids" goutte
  1125.       sar   ax,11
  1126.       sub   bl,al                     ; --> perturbation(X,Y)
  1127.       cmp   bl,-32
  1128.       jge   no_over
  1129.       mov   bl,-32
  1130. no_over:
  1131.       mov   BYTE PTR es:[si],bl
  1132.  
  1133.       MPOP  eax,bx,dx,si,es
  1134.       ret
  1135.  
  1136. Gouttes ENDP
  1137.  
  1138. ;**************
  1139. ;* Tourbillon *
  1140. ;**************
  1141. ALIGN
  1142. EVEN
  1143. Spiral PROC NEAR    ; !!!!! Gros bug qui donne bien !!!!!
  1144.  
  1145.        MPUSH eax,bx,cx,dx,si,es
  1146.  
  1147.        mov  ax,BufPtr
  1148.        mov  es,ax
  1149.  
  1150.        xor  eax,eax
  1151.        mov  ax,SpirAngle  ; take current "angle"
  1152.        mov  bx,WORD PTR[_SinusTbl+eax*2+256] ; -cos(theta)
  1153.        neg  bx 
  1154.        mov  ax,WORD PTR[_SinusTbl+eax*2]     ; sin(theta)
  1155.        imul SpirRadius    ; multiplied by radius
  1156.      ;  sar  dx,8+3
  1157.        sar  ax,8+3        ; /256 !!!!
  1158.        add  ax,15         ; middle of y axis
  1159.        js   SpirOver
  1160.        cmp  ax,30         ; check overflow ???
  1161.        jge  SpirOver
  1162.        mov  si,WORD PTR[Ytable+eax*2] ; take corresponding y 
  1163.        mov  ax,bx
  1164.        imul SpirRadius    ; -cos*radius
  1165.    ;    sar  dx,8 
  1166.        sar  ax,8          ; /256
  1167.        add  ax,80         ; middle of x axis
  1168.        js   SpirOver
  1169.        cmp  ax,160        ; check overflow ???
  1170.        jge  SpirOver
  1171.        add  si,ax         ; position+x
  1172.  
  1173.        mov  al,BYTE PTR es:[si]
  1174.        sub  al,16         ; cut water !!!!
  1175.        cmp  al,-32
  1176.        jge  @F
  1177.        mov  al,-32
  1178. @@:    mov  BYTE PTR es:[si],al                  
  1179.      
  1180. SpirOver:
  1181.   
  1182.        mov  cx,CurveStep  ; step !!     
  1183.        test cx,cx
  1184.        jnz  @F
  1185.        mov  cx,1
  1186. @@:
  1187.        inc  SpirAngle
  1188.        and  SpirAngle,511
  1189.        inc  SpirRadius
  1190.        and  SpirRadius,511 
  1191.        dec  cx
  1192.        jnz  @B
  1193.  
  1194.        MPOP eax,bx,cx,dx,si,es        
  1195.  
  1196.        ret
  1197.  
  1198. Spiral ENDP
  1199.  
  1200. ;***********
  1201. ;* Circles *
  1202. ;***********
  1203. ALIGN
  1204. EVEN
  1205. ;------ Bresenham's circle algo -------
  1206.  
  1207. Circles PROC NEAR   ; --> draw circle in the map coord 80,15 ....
  1208.  
  1209.        MPUSH    eax,bx,cx,edx,si,di,es
  1210.        
  1211.        mov      ax,BufPtr
  1212.        mov      es,ax
  1213.  
  1214.        mov      cx,CurveStep
  1215.        test     cx,cx
  1216.        jnz      DoCircles
  1217.        mov      cx,1
  1218. DoCircles: 
  1219.        push     cx
  1220.  
  1221.        xor      eax,eax    ; x = 0
  1222.        xor      edx,edx    ; y = radius
  1223.        mov      dx,CircRadius; with x = 0 and y = radius, first point is at 270°
  1224.        inc      CircRadius
  1225.        cmp      CircRadius,255
  1226.        jl       @F
  1227.        mov      Circ,0     ; disable circles
  1228. @@:
  1229.  
  1230.        mov      di,dx
  1231.        sal      di,1       
  1232.        sub      di,3
  1233.        neg      di         ; d = 3 - (2*radius) --> init the decision var
  1234.  
  1235. Circl: cmp      ax,dx      ; while (x<y)
  1236.        jg       OutLoop
  1237.  
  1238.        push     dx
  1239.        sar      dx,1          
  1240.    
  1241. ; eigth-point symmetry
  1242.        cmp      dx,13
  1243.        jg       NoPoint
  1244.        cmp      ax,79
  1245.        jg       NoPoint
  1246.        
  1247.        push     si
  1248.        mov      cx,WORD PTR[Ytable+edx*2] ; y * 160
  1249.        sub      cx,(Meche+2)*160
  1250.        mov      si,ax                     ; + x
  1251.        add      si,cx
  1252.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80+x,15+y)
  1253.        sub      bl,2
  1254.        cmp      bl,-32
  1255.        jge      @F
  1256.        mov      bl,-32
  1257. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1258.        mov      si,ax
  1259.        sub      si,cx
  1260.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80+x,15-y)
  1261.        sub      bl,2
  1262.        cmp      bl,-32
  1263.        jge      @F
  1264.        mov      bl,-32
  1265. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1266.        mov      si,ax
  1267.        neg      si
  1268.        sub      si,cx
  1269.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80-x,15-y)
  1270.        sub      bl,2
  1271.        cmp      bl,-32
  1272.        jge      @F
  1273.        mov      bl,-32
  1274. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1275.        mov      si,cx
  1276.        sub      si,ax
  1277.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80-x,15+y)
  1278.        sub      bl,2
  1279.        cmp      bl,-32
  1280.        jge      @F
  1281.        mov      bl,-32
  1282. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1283.        mov      cx,WORD PTR[Ytable+eax*2] ; x * 160
  1284.        sub      cx,(Meche+2)*160
  1285.        mov      si,dx
  1286.        sub      si,cx
  1287.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80+y,15-x)
  1288.        sub      bl,2
  1289.        cmp      bl,-32
  1290.        jge      @F
  1291.        mov      bl,-32
  1292. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1293.        mov      si,dx
  1294.        neg      si
  1295.        sub      si,cx
  1296.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80-y,15-x)
  1297.        sub      bl,2
  1298.        cmp      bl,-32
  1299.        jge      @F
  1300.        mov      bl,-32
  1301. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1302.        mov      si,cx
  1303.        sub      si,dx
  1304.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80-y,15+x)
  1305.        sub      bl,2
  1306.        cmp      bl,-32
  1307.        jge      @F
  1308.        mov      bl,-32
  1309. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1310.        mov      si,cx
  1311.        add      si,dx
  1312.        mov      bl,BYTE PTR es:[si+160*(14+Meche+2)+80] ; plot(80+y,15+x)
  1313.        sub      bl,2
  1314.        cmp      bl,-32
  1315.        jge      @F
  1316.        mov      bl,-32
  1317. @@:    mov      BYTE PTR es:[si+160*(14+Meche+2)+80],bl
  1318.        pop      si
  1319.  
  1320. NoPoint: pop    dx
  1321.  
  1322.        test     di,di      ; if(d<0)
  1323.        jns      @F         ; don't decrement y
  1324.        add      di,6
  1325.        mov      si,ax
  1326.        sal      si,2
  1327.        add      di,si      ; d += (4 * x) + 6  --> update decision variable 
  1328.        inc      ax         ; increment x   
  1329.   
  1330.        jmp      Circl      ; end of while (x < y)
  1331.   
  1332. @@:    add      di,10
  1333.        mov      si,ax
  1334.        sub      si,dx
  1335.        sal      si,2
  1336.        add      di,si      ; d += 4*(x - y) + 10 --> """""
  1337.        dec      dx         ; decrement y
  1338.        inc      ax         ; increment x
  1339.               
  1340.        jmp      Circl      ; end of while (x < y)   
  1341.              
  1342. OutLoop:
  1343.        
  1344.        pop      cx
  1345.        dec      cx
  1346.        jnz      DoCircles
  1347.       
  1348.  
  1349.        MPOP     eax,bx,cx,edx,si,di,es
  1350.  
  1351.        ret
  1352.  
  1353. Circles ENDP
  1354.  
  1355. ALIGN
  1356. EVEN
  1357. ;************************
  1358. ; petits ploufs !!!! ....  
  1359. ;************************
  1360. Ploufs PROC NEAR                      ; petits ploufs
  1361.  
  1362.       MPUSH ax,bx,cx,dx,si
  1363.  
  1364.       cmp   cs:[Encore],0             ; new plouf ???? 
  1365.       jg    @F
  1366.  
  1367.       call  _GetRandom                ; Random(Radius)
  1368.       xor   dx,dx
  1369.       mov   si,32768/32               ; rayon 32 au max !!! 
  1370.       div   si
  1371.       push  ax  
  1372.        
  1373.       call  _GetRandom                ; Random(Y)
  1374.       xor   dx,dx
  1375.       mov   si,32768/30
  1376.       div   si
  1377.       mov   bx,ax
  1378.  
  1379.       call  _GetRandom                ; Random(X)
  1380.       xor   dx,dx
  1381.       mov   si,32768/160
  1382.       div   si
  1383.       pop   dx       
  1384.  
  1385. ; AX = x  BX = y  DX = radius
  1386.  
  1387.       mov   cs:[Encore],dx            ; nb steps ...
  1388.       mov   cs:[Rayon],0
  1389.       mov   cs:[Xcoord],ax
  1390.       mov   cs:[Ycoord],bx 
  1391.  
  1392. @@:   
  1393.  
  1394.       mov   cx,CurveStep
  1395.       test  cx,cx
  1396.       jnz   @F
  1397.       mov   cx,1
  1398. @@:
  1399.       mov   ax,cs:[Xcoord]
  1400.       mov   bx,cs:[Ycoord]
  1401.       mov   dx,cs:[Rayon]
  1402.       call  Cirk                      ; do circle
  1403.  
  1404.       inc   cs:[Rayon]                ; maj local var ...
  1405.       dec   cs:[Encore]
  1406.       dec   cx
  1407.       jnz   @B  
  1408.        
  1409.       MPOP  ax,bx,cx,dx,si
  1410.       ret
  1411.  
  1412. Encore DW 0
  1413. Rayon  DW ?
  1414. Xcoord DW ?
  1415. Ycoord DW ?
  1416.  
  1417. Ploufs ENDP
  1418.  
  1419.  
  1420.  
  1421. ;****************************
  1422. ;* general rout for Circles *
  1423. ;****************************
  1424. ALIGN
  1425. EVEN
  1426. ;------ Bresenham's circle algo -------
  1427.  
  1428. Cirk   PROC NEAR   ; --> draw circle in the map coord x,y radius r ....
  1429.  
  1430. ; AX = x   BX = y   DX = radius
  1431.  
  1432.        MPUSH    ax,ebx,cx,dx,si,di,es
  1433.        
  1434.        mov      cs:[Xcenter],ax ; save coordinates
  1435.        mov      cs:[Ycenter],bx 
  1436.  
  1437.        mov      ax,BufPtr
  1438.        mov      es,ax
  1439.  
  1440.        xor      ebx,ebx
  1441.  
  1442.        xor      ax,ax      ; x = 0   y = radius (dx !!!)
  1443.                            ; with x = 0 and y = radius, first point is at 270°
  1444.  
  1445.        mov      di,dx
  1446.        sal      di,1       
  1447.        sub      di,3
  1448.        neg      di         ; d = 3 - (2*radius) --> init the decision var
  1449.  
  1450. Circl: cmp      ax,dx      ; while (x<y)
  1451.        jg       OutLoop
  1452.  
  1453.        push     dx
  1454.        sar      dx,1          
  1455.    
  1456. ; eigth-point symmetry
  1457.        
  1458.        mov      bx,cs:[Xcenter]
  1459.        add      bx,ax
  1460.        mov      cs:[xxcp],bx
  1461.        mov      bx,cs:[Ycenter]
  1462.        add      bx,ax
  1463.        mov      cs:[yxcp],bx
  1464.        mov      bx,cs:[Xcenter]
  1465.        sub      bx,ax
  1466.        mov      cs:[xxcm],bx
  1467.        mov      bx,cs:[Ycenter]
  1468.        sub      bx,ax
  1469.        mov      cs:[yxcm],bx
  1470.        mov      bx,cs:[Xcenter]
  1471.        add      bx,dx
  1472.        mov      cs:[xycp],bx
  1473.        mov      bx,cs:[Ycenter]
  1474.        add      bx,dx
  1475.        mov      cs:[yycp],bx
  1476.        mov      bx,cs:[Xcenter]
  1477.        sub      bx,dx
  1478.        mov      cs:[xycm],bx
  1479.        mov      bx,cs:[Ycenter]
  1480.        sub      bx,dx
  1481.        mov      cs:[yycm],bx    
  1482.  
  1483.        push     si
  1484.  
  1485.        mov      bx,cs:[yycp]
  1486.        cmp      bx,29
  1487.        jg       Next1
  1488.        cmp      bx,0
  1489.        jl       Next1
  1490.        mov      bx,cs:[xxcp]
  1491.        cmp      bx,159
  1492.        jg       Next1
  1493.        cmp      bx,0
  1494.        jl       Next1  
  1495.  
  1496. ; si ok .........
  1497.        mov      bx,cs:[yycp]
  1498.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1499.        add      si,cs:[xxcp]              ; + x
  1500.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1501.        dec      bl
  1502.        cmp      bl,-32
  1503.        jge      @F
  1504.        mov      bl,-32
  1505. @@:    mov      BYTE PTR es:[si],bl
  1506.  
  1507. Next1:
  1508.        mov      bx,cs:[yycm]
  1509.        cmp      bx,29
  1510.        jg       Next2
  1511.        cmp      bx,0
  1512.        jl       Next2
  1513.        mov      bx,cs:[xxcp]
  1514.        cmp      bx,159
  1515.        jg       Next2
  1516.        cmp      bx,0
  1517.        jl       Next2  
  1518.  
  1519. ; si ok .........
  1520.        mov      bx,cs:[yycm]
  1521.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1522.        add      si,cs:[xxcp]              ; + x 
  1523.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1524.        dec      bl
  1525.        cmp      bl,-32
  1526.        jge      @F
  1527.        mov      bl,-32
  1528. @@:    mov      BYTE PTR es:[si],bl
  1529.  
  1530. Next2:
  1531.        mov      bx,cs:[yycp]
  1532.        cmp      bx,29
  1533.        jg       Next3
  1534.        cmp      bx,0
  1535.        jl       Next3
  1536.        mov      bx,cs:[xxcm]
  1537.        cmp      bx,159
  1538.        jg       Next3
  1539.        cmp      bx,0
  1540.        jl       Next3  
  1541.  
  1542. ; si ok .........
  1543.        mov      bx,cs:[yycp]
  1544.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1545.        add      si,cs:[xxcm]              ; + x
  1546.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1547.        dec      bl
  1548.        cmp      bl,-32
  1549.        jge      @F
  1550.        mov      bl,-32
  1551. @@:    mov      BYTE PTR es:[si],bl
  1552.  
  1553. Next3:
  1554.        mov      bx,cs:[yycm]
  1555.        cmp      bx,29
  1556.        jg       Next4
  1557.        cmp      bx,0
  1558.        jl       Next4
  1559.        mov      bx,cs:[xxcm]
  1560.        cmp      bx,159
  1561.        jg       Next4
  1562.        cmp      bx,0
  1563.        jl       Next4  
  1564.  
  1565. ; si ok .........
  1566.        mov      bx,cs:[yycm]
  1567.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1568.        add      si,cs:[xxcm]              ; + x
  1569.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1570.        dec      bl
  1571.        cmp      bl,-32
  1572.        jge      @F
  1573.        mov      bl,-32
  1574. @@:    mov      BYTE PTR es:[si],bl
  1575.  
  1576. Next4:
  1577.        mov      bx,cs:[yxcp]
  1578.        cmp      bx,29
  1579.        jg       Next5
  1580.        cmp      bx,0
  1581.        jl       Next5
  1582.        mov      bx,cs:[xycp]
  1583.        cmp      bx,159
  1584.        jg       Next5
  1585.        cmp      bx,0
  1586.        jl       Next5  
  1587.  
  1588. ; si ok .........
  1589.        mov      bx,cs:[yxcp]
  1590.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1591.        add      si,cs:[xycp]              ; + x
  1592.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1593.        dec      bl
  1594.        cmp      bl,-32
  1595.        jge      @F
  1596.        mov      bl,-32
  1597. @@:    mov      BYTE PTR es:[si],bl
  1598.  
  1599. Next5:
  1600.        mov      bx,cs:[yxcm]
  1601.        cmp      bx,29
  1602.        jg       Next6
  1603.        cmp      bx,0
  1604.        jl       Next6
  1605.        mov      bx,cs:[xycp]
  1606.        cmp      bx,159
  1607.        jg       Next6
  1608.        cmp      bx,0
  1609.        jl       Next6  
  1610.  
  1611. ; si ok .........
  1612.        mov      bx,cs:[yxcm]
  1613.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1614.        add      si,cs:[xycp]              ; + x
  1615.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1616.        dec      bl
  1617.        cmp      bl,-32
  1618.        jge      @F
  1619.        mov      bl,-32
  1620. @@:    mov      BYTE PTR es:[si],bl
  1621.  
  1622. Next6:
  1623.        mov      bx,cs:[yxcp]
  1624.        cmp      bx,29
  1625.        jg       Next7
  1626.        cmp      bx,0
  1627.        jl       Next7
  1628.        mov      bx,cs:[xycm]
  1629.        cmp      bx,159
  1630.        jg       Next7
  1631.        cmp      bx,0
  1632.        jl       Next7  
  1633.  
  1634. ; si ok .........
  1635.        mov      bx,cs:[yxcp]
  1636.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1637.        add      si,cs:[xycm]              ; + x
  1638.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1639.        dec      bl
  1640.        cmp      bl,-32
  1641.        jge      @F
  1642.        mov      bl,-32
  1643. @@:    mov      BYTE PTR es:[si],bl
  1644.  
  1645. Next7:
  1646.        mov      bx,cs:[yxcm]
  1647.        cmp      bx,29
  1648.        jg       Next8
  1649.        cmp      bx,0
  1650.        jl       Next8
  1651.        mov      bx,cs:[xycm]
  1652.        cmp      bx,159
  1653.        jg       Next8
  1654.        cmp      bx,0
  1655.        jl       Next8  
  1656.  
  1657. ; si ok .........
  1658.        mov      bx,cs:[yxcm]
  1659.        mov      si,WORD PTR[Ytable+ebx*2] ; y * 160
  1660.        add      si,cs:[xycm]              ; + x
  1661.        mov      bl,BYTE PTR es:[si]       ; plot(x,y)
  1662.        dec      bl
  1663.        cmp      bl,-32
  1664.        jge      @F
  1665.        mov      bl,-32
  1666. @@:    mov      BYTE PTR es:[si],bl
  1667.  
  1668.  
  1669. Next8:
  1670.  
  1671.  
  1672. NoPoint:
  1673.        pop      si 
  1674.        pop      dx
  1675.  
  1676.        test     di,di      ; if(d<0)
  1677.        jns      @F         ; don't decrement y
  1678.        add      di,6
  1679.        mov      si,ax
  1680.        sal      si,2
  1681.        add      di,si      ; d += (4 * x) + 6  --> update decision variable 
  1682.        inc      ax         ; increment x   
  1683.   
  1684.        jmp      Circl      ; end of while (x < y)
  1685.   
  1686. @@:    add      di,10
  1687.        mov      si,ax
  1688.        sub      si,dx
  1689.        sal      si,2
  1690.        add      di,si      ; d += 4*(x - y) + 10 --> """""
  1691.        dec      dx         ; decrement y
  1692.        inc      ax         ; increment x
  1693.               
  1694.        jmp      Circl      ; end of while (x < y)   
  1695.              
  1696. OutLoop:
  1697.        
  1698.        MPOP     ax,ebx,cx,dx,si,di,es
  1699.  
  1700.        ret
  1701.  
  1702. Xcenter DW ?
  1703. Ycenter DW ?
  1704. xxcp    DW ?
  1705. yxcp    DW ?
  1706. xxcm    DW ?
  1707. yxcm    DW ?
  1708. xycp    DW ?
  1709. yycp    DW ?
  1710. xycm    DW ?
  1711. yycm    DW ?    
  1712.  
  1713. Cirk   ENDP
  1714.  
  1715. ;******************
  1716. ;* Put BackGround *
  1717. ;******************
  1718.  
  1719. ALIGN
  1720. EVEN
  1721. PutBack PROC NEAR
  1722.  
  1723.         MPUSH ax,cx,dx,ds,es
  1724.  
  1725.         mov   dx,3c8h
  1726.         xor   al,al
  1727.         out   dx,al
  1728.         inc   dl
  1729.         mov   cx,768
  1730. @@:     out   dx,al          ; set screen to black
  1731.         dec   cx
  1732.         jnz   @B 
  1733.  
  1734.         VSYNC
  1735.  
  1736.         mov   ax,Backseg
  1737.         mov   ds,ax
  1738.         mov   si,768+32
  1739.         mov   ax,0a000h
  1740.         mov   es,ax
  1741.  
  1742.  
  1743.         i = 0
  1744.         REPT  4
  1745.         mov   dx,3c4h   ; select right bitplane
  1746.         mov   ax,02h+(1 SHL i)*256
  1747.         out   dx,ax
  1748.  
  1749.         xor   di,di  
  1750.  
  1751.         mov   cx,320*138/4    ; background is 320x138 pixels
  1752. @@:     lodsb           ; copy to 4 page in videomem !!!
  1753.         mov   BYTE PTR es:[Screen2+di],al
  1754.         mov   BYTE PTR es:[Screen3+di],al
  1755.         mov   BYTE PTR es:[Screen4+di],al              
  1756.         stosb
  1757.         add   si,3
  1758.         dec   cx
  1759.         jnz   @B
  1760.  
  1761.         sub   si,320*138-1
  1762.  
  1763.         i = i + 1
  1764.         ENDM
  1765.  
  1766.         MPOP  ax,cx,dx,ds,es
  1767.  
  1768.         ret
  1769.  
  1770. PutBack ENDP
  1771.  
  1772. ;***********
  1773. ;* Put TXT *
  1774. ;***********
  1775.  
  1776. ALIGN
  1777. EVEN
  1778. PutTxt PROC NEAR
  1779.  
  1780.        MPUSH   eax,cx,si,di,es
  1781.  
  1782.        mov     cx,CurveStep       
  1783.        sub     WORD PTR cs:[Pwait],cx  ; maj pause 
  1784.        cmp     WORD PTR cs:[PWait],0   ; doit-on-printer ????
  1785.        jg      Passer
  1786.  
  1787.        mov     ax,BufPtr    ; set es to MAP
  1788.        mov     es,ax
  1789.        mov     di,(2+Meche)*Xsize ; debut map ....
  1790.        
  1791.        mov     al,cs:[Intensity]
  1792.        mov     ah,al        ; copy intensity in all EAX !!!
  1793.        mov     bx,ax
  1794.        shl     eax,16
  1795.        mov     ax,bx
  1796.        cld
  1797.  
  1798. ; take the right routine .....
  1799.        mov     si,cs:[RoutPtr]
  1800.        cmp     si,OFFSET Rout+16
  1801.        jae     Passer
  1802.        add     di,cs:[si]   ; centrage bitmap
  1803.  
  1804.        call    WORD PTR cs:[si+2]  ; call routine ...
  1805.  
  1806.        cmp     cs:[Intensity],15   ; trop haut ???
  1807.        jge     NoMonter
  1808.        cmp     cs:[Intensity],-7   ; trop bas ???
  1809.        jle     NoMonter
  1810.  
  1811.        mov     ax,WORD PTR cs:[CurPause]
  1812.        mov     WORD PTR cs:[Pause],ax
  1813.  
  1814.        mov     ax,cs:[Incr]
  1815.        mov     cx,CurveStep
  1816.        test    cx,cx
  1817.        jnz     @F
  1818.        mov     cx,1         
  1819. @@:    add     WORD PTR cs:[Comp],ax ; elever/baisser 
  1820.        dec     cx
  1821.        jnz     @B
  1822.  
  1823. NoMonter:
  1824.        mov     cx,CurveStep
  1825.        sub     WORD PTR cs:[Pause],cx ; pause ....
  1826.        cmp     WORD PTR cs:[Pause],0
  1827.        jg      Passer
  1828.        mov     ax,cs:[CurPause]
  1829.        xchg    ax,cs:[CurPause+2]     ; swap lever/baisser pauses
  1830.        mov     cs:[CurPause],ax
  1831.        neg     cs:[Incr]
  1832.        mov     ax,cs:[Incr]
  1833.        add     WORD PTR cs:[Comp],ax  ; rabaisser/relever 1 fois     
  1834.  
  1835.        inc     cs:[NbSwap]            ; inc nb swaps ...
  1836.        cmp     cs:[NbSwap],2
  1837.        jb      Passer                 
  1838.  
  1839.        mov     cs:[NbSwap],0
  1840.        mov     WORD PTR cs:[Comp],0     ; remise à 0 du niveau ... 
  1841.        mov     WORD PTR cs:[PWait],70*2 ; nouvelle lettre si monte et descendu
  1842.        add     WORD PTR cs:[RoutPtr],4  ; next lettre
  1843.  
  1844. Passer:
  1845.  
  1846.        MPOP    eax,cx,si,di,es 
  1847.  
  1848.        ret
  1849.  
  1850. wavtxt1:
  1851.        INCLUDE wavtxt1.asm
  1852.        ret
  1853.  
  1854. wavtxt2:
  1855.        INCLUDE wavtxt2.asm
  1856.        ret
  1857.  
  1858. wavtxt3:
  1859.        INCLUDE wavtxt3.asm 
  1860.        ret
  1861.  
  1862. wavtxt4:
  1863.        INCLUDE wavtxt4.asm
  1864.        ret
  1865.  
  1866. Comp      DB 0
  1867. Intensity DB 0
  1868. NbSwap    DB 0
  1869.  
  1870. EVEN
  1871. PWait     DW 0
  1872. Pause     DW 0
  1873. Incr      DW 64
  1874. CurPause  DW 70*5,70
  1875. RoutPtr   DW OFFSET Rout
  1876. Rout      DW 15+5*160,OFFSET wavtxt3
  1877.           DW 40+5*160,OFFSET wavtxt1
  1878.           DW 45+5*160,OFFSET wavtxt2
  1879.           DW 40+5*160,OFFSET wavtxt4
  1880.  
  1881. PutTxt ENDP
  1882.  
  1883. ;******************
  1884. ;* Put MandelBrot *
  1885. ;******************
  1886.  
  1887. PutMandel PROC NEAR
  1888.  
  1889.           MPUSH   ax,cx,bx,dx,si,di,ds,es
  1890.  
  1891.           cmp     WORD PTR cs:[MDelay],5*70
  1892.           jge     EndMandel
  1893.  
  1894.           mov     ax,BufPtr    ; set es to MAP
  1895.           mov     es,ax
  1896.           mov     di,(2+Meche)*Xsize ; debut map ....
  1897.  
  1898.           mov     cx,CurveStep
  1899.           mov     cs:[NbStep],cx
  1900.           push    cx
  1901.           mov     dx,Picseg
  1902.           mov     bx,TmpOfs
  1903.           mov     ax,TmpSeg
  1904.           mov     ds,ax
  1905.           xor     si,si
  1906.           add     di,40+5*160 
  1907.  
  1908.           INCLUDE mandel.asm
  1909.  
  1910.           pop     cx
  1911.  
  1912.           cmp     BYTE PTR cs:[Morph],63
  1913.           jge     @F
  1914.  
  1915.           test    cx,cx
  1916.           jnz     Rattrap
  1917.           mov     cx,1
  1918. Rattrap:
  1919.           push    cx
  1920.  
  1921.           xor     si,si
  1922.           mov     es,dx       ; set to original map
  1923.           xor     di,di
  1924.           mov     cx,bx       ; nb of bytes ...
  1925. ToMorph:  mov     al,es:[di]
  1926.           add     BYTE PTR ds:[si+bx],al
  1927.           adc     BYTE PTR ds:[si],0   ; carry
  1928.           add     BYTE PTR ds:[si+bx],al
  1929.           adc     BYTE PTR ds:[si],0   ; carry
  1930.           add     BYTE PTR ds:[si+bx],al
  1931.           adc     BYTE PTR ds:[si],0   ; carry
  1932.           add     BYTE PTR ds:[si+bx],al
  1933.           adc     BYTE PTR ds:[si],0   ; carry
  1934.           inc     si
  1935.           inc     di
  1936.           dec     cx
  1937.           jnz     ToMorph
  1938.  
  1939.           inc     BYTE PTR cs:[Morph]  ; step + 1
  1940.  
  1941.           pop     cx
  1942.           dec     cx
  1943.           jnz     Rattrap
  1944.  
  1945.           jmp     SkipCompte
  1946.  
  1947. @@:       mov     cx,WORD PTR cs:[NbStep]
  1948.           test    cx,cx
  1949.           jnz     RatPause
  1950.           mov     cx,1
  1951. RatPause:
  1952.           inc     WORD PTR cs:[MDelay]
  1953.           dec     cx
  1954.           jnz     RatPause
  1955.  
  1956. SkipCompte:
  1957.  
  1958. EndMandel:
  1959.           MPOP    ax,cx,bx,dx,si,di,ds,es
  1960.  
  1961.           ret
  1962.  
  1963. Morph     DB 0
  1964. EVEN
  1965. MDelay    DW 0
  1966. NbStep    DW 0
  1967.  
  1968. PutMandel ENDP
  1969.  
  1970. ALIGN
  1971. EVEN
  1972. InitMap PROC NEAR
  1973.  
  1974.        MPUSH eax,cx,di,es
  1975.  
  1976. ;---- init flags d'autorisation ----
  1977.        mov  Goutte,1
  1978.        mov  Wave1,0
  1979.        mov  Wave2,0
  1980.        mov  Oxygen,0  
  1981.        mov  Spir,0
  1982.        mov  Circ,0
  1983.        mov  Plouf,0
  1984.        mov  WavTxt,0
  1985.        mov  Mandel,0
  1986. ;----                ----
  1987.        mov  CurvePtr,0
  1988.        mov  SpirAngle,0
  1989.        mov  SpirRadius,0
  1990.        mov  CircRadius,0
  1991.        mov  WaveFlag,1 
  1992.  
  1993.        mov  ax,TmpSeg
  1994.        mov  es,ax
  1995.        xor  di,di
  1996.        mov  cx,TmpOfs
  1997.        shr  cx,1
  1998.        xor  eax,eax
  1999.        rep  stosd      ; clean TmpMap
  2000.  
  2001.        push ds
  2002.        pop  es
  2003.        xor  eax,eax    ; clean eax 
  2004.        mov  cx,Xsize/4
  2005.        mov  di,OFFSET Maxima
  2006.        rep  stosd      ; clean maxima buffer (ES=Old DS !!!)
  2007.        mov  ax,BufSeg
  2008.        mov  es,ax
  2009.        mov  cx,(SizeBuf)/4
  2010.        xor  eax,eax
  2011.        xor  di,di
  2012.        rep  stosd      ; clean map buffer
  2013.        mov  ax,BufSeg2
  2014.        mov  es,ax
  2015.        mov  cx,(SizeBuf)/4
  2016.        xor  eax,eax
  2017.        xor  di,di
  2018.        rep  stosd
  2019.  
  2020.        MPOP eax,cx,di,es
  2021.  
  2022.        ret
  2023.  
  2024. InitMap ENDP
  2025.  
  2026. ;----- VFAST Line !!!! - Self modifying Pregenerated code - --------
  2027.  
  2028. ;lably49:
  2029.  INCLUDE vlin.inc
  2030.  
  2031. ICE_TEXT ENDS
  2032.  
  2033.  END
  2034.